package com.hubu.blog.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.sql.Date;
import java.time.LocalDateTime;

import java.io.Serial;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 博客用户表 实体类。
 *
 * @author 331126135@qq.com
 * @since 2025-06-10
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "博客用户表")
@Table(value = "blog_user", schema = "db_blog")
public class User implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 用户ID，雪花算法生成
     */
    @Id
    @Schema(description = "用户ID，雪花算法生成")
    private Long id;

    /**
     * 用户名，唯一标识
     */
    @Schema(description = "用户名，唯一标识")
    private String username;

    /**
     * 加密后的密码
     */
    @Schema(description = "加密后的密码")
    private String password;

    /**
     * 密码加密盐值
     */
    @Schema(description = "密码加密盐值")
    private String salt;

    /**
     * 用户昵称，显示用
     */
    @Schema(description = "用户昵称，显示用")
    private String nickname;

    /**
     * 头像URL地址
     */
    @Schema(description = "头像URL地址")
    private String avatar;

    /**
     * 电子邮箱
     */
    @Schema(description = "电子邮箱")
    private String email;

    /**
     * 手机号码
     */
    @Schema(description = "手机号码")
    private String phone;

    /**
     * 性别：0-未知 1-男 2-女
     */
    @Schema(description = "性别：0-未知 1-男 2-女")
    private Integer gender;

    /**
     * 出生日期
     */
    @Schema(description = "出生日期")
    private Date birthday;

    /**
     * 个人简介
     */
    @Schema(description = "个人简介")
    private String introduction;

    /**
     * 账号状态: disabled-禁用, active-正常, locked-锁定
     */
    @Schema(description = "账号状态: disabled-禁用, active-正常, locked-锁定")
    private String status;

    /**
     * 最后登录时间
     */
    @Schema(description = "最后登录时间")
    private LocalDateTime lastLoginTime;

    /**
     * 最后登录IP
     */
    @Schema(description = "最后登录IP")
    private String lastLoginIp;

    /**
     * 是否删除: TRUE(1)-已删除, FALSE(0)-未删除
     */
    @Column(isLogicDelete = true)
    @Schema(description = "是否删除: TRUE(1)-已删除, FALSE(0)-未删除")
    private Boolean isDeleted;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    /**
     * 删除时间
     */
    @Schema(description = "删除时间")
    private LocalDateTime deleteTime;

}
